import React from 'react';
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { ROUTES } from '../../utils/conts';
import { useSelector } from 'react-redux';

const PrivateRouter = () => {
  const location = useLocation();
  const { isAuth } = useSelector(({ auth }) => auth);
 
  // return isAuth ? <Outlet /> : <Navigate to={ROUTES.LOGIN} state={{ from: location }} replace />;
  return isAuth ? <Outlet /> : <Navigate to={ROUTES.LOGIN} />;

};

export default PrivateRouter;
